/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package net.sf.odinms.net.channel.handler;

import net.sf.odinms.client.MapleCharacter;
import net.sf.odinms.client.MapleClient;
import net.sf.odinms.net.AbstractMaplePacketHandler;
import net.sf.odinms.scripting.npc.NPCScriptManager;
import net.sf.odinms.tools.data.input.SeekableLittleEndianAccessor;

/**
 * @author Bassoe
 */
public class EngageHandler extends AbstractMaplePacketHandler {
    private static org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(EngageHandler.class);
    @Override
    public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
        byte mode = slea.readByte();
        switch (mode) {
            case 0: // invite for marriage
                String name = slea.readMapleAsciiString();
                slea.readInt(); // item
                MapleCharacter partner = c.getChannelServer().getPlayerStorage().getCharacterByName(name);
                NPCScriptManager.getInstance().start(partner.getClient(), 9201002, c.getPlayer());
                break;
            case 1: // stop the search
                break;
            default:
                log.info("New mode ({}) found for EngageHandler", mode);
        }
    }
}

